import requests
import config

class MyDemoApi():
    def __init__(self):
        # 注册url
        self.register_url = "http://127.0.0.1:5000/registered"
        # 登录url
        self.login_url = "http://127.0.0.1:5000/login"
        # 获取信息
        self.user_url = "http://127.0.0.1:5000/getuser/"
        # 删除
        self.exit_url = "http://127.0.0.1:5000/exit/zhangsan"

    def my_register(self,data):
        # 发送请求
        response = requests.post(url=self.register_url, json=data)
        # 4、获取相应信息
        return response

    def my_login(self,data):
        response = requests.post(url=self.login_url, json=data)
        return response

    def my_getuser(self,name):
        self.user_url = self.user_url + name
        response = requests.get(url=self.user_url,headers=config.header)
        return response

    def my_exit(self):
        pass